package com.bytedance.common.utility.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.TextView;

public class DrawableCenterTextView extends TextView {
    public DrawableCenterTextView(Context arg1) {
        super(arg1);
    }

    public DrawableCenterTextView(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
    }

    public DrawableCenterTextView(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    public DrawableCenterTextView(Context arg1, AttributeSet arg2, int arg3, int arg4) {
        super(arg1, arg2, arg3, arg4);
    }

    protected void onDraw(Canvas arg7) {
        float v5 = 2f;
        Drawable[] v0 = this.getCompoundDrawables();
        if (v0 != null && v0.length == 4) {
            Drawable v1 = v0[0];
            Drawable v0_1 = v0[2];
            if (v1 == null && v0_1 == null) {
            } else {
                float v2 = this.getPaint().measureText(this.getText().toString());
                int v3 = this.getCompoundDrawablePadding();
                int v0_2 = v1 != null ? v1.getIntrinsicWidth() : v0_1.getIntrinsicWidth();
                float v0_3 = (((float) v0_2)) + v2 + (((float) v3));
                if (v1 != null) {
                    this.setGravity(19);
                    arg7.translate(((((float) this.getWidth())) - v0_3) / v5, 0f);
                } else {
                    this.setGravity(21);
                    arg7.translate((v0_3 - (((float) this.getWidth()))) / v5, 0f);
                }
            }
        }
        super.onDraw(arg7);
    }
}

